<template>
  <el-button v-waves :size="size" :type="type" class="ml-10px" @click="handelExport">
    <i :class="icon" class="wh-14px mr-6px"></i>
    导出
  </el-button>
</template>

<script setup lang="ts">
  import { ElMessage } from 'element-plus'

  defineOptions({
    name: 'OptionExport',
  })

  withDefaults(
    defineProps<{
      icon?: string
      size?: string
      type?: string
    }>(),
    {
      size: 'default',
      icon: 'i-ep-download',
      type: 'warning',
    }
  )

  const emits = defineEmits<{
    (e: 'on-export'): void
  }>()

  const handelExport = () => {
    ElMessage({ message: '导出中...', type: 'success', duration: 7 * 1000 })

    emits('on-export')
  }
</script>
